'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
	async up(queryInterface, Sequelize) {
		/**
		 * Add altering commands here.
		 *
		 * Example:
		 * await queryInterface.createTable('users', { id: Sequelize.INTEGER });
		 */

		const { STRING } = Sequelize;

		//单条插入
		return queryInterface.addColumn('app_user', 'phone', {
			type: STRING(11),
			allowNull: true
		});

		//多条插入
		return Promise.all([
			queryInterface.addColumn('app_user', 'phone', {
				type: STRING(11),
				allowNull: true
			})
		]);
	},

	async down(queryInterface, Sequelize) {
		/**
		 * Add reverting commands here.
		 *
		 * Example:
		 * await queryInterface.dropTable('users');
		 */

		return queryInterface.removeColumn('app_user', 'phone');
	}
};
